<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Add</title>
</head>
<body>
    <div>
        <div style="color: red">${errorMsg}</div>
        <form action="add" method="post" enctype="multipart/form-data">
            <div>
                账号：<input type="text" name="account" id="account"><span style="color: red">${accountError}</span>
            </div>
            <div>
                真实姓名：<input type="text" name="realName"><span style="color: red">${realNameError}</span>
            </div>
            <div>
                密码：<input type="text" name="password"><span style="color: red">${passwordError}</span>
            </div>
            <div>
                性别： <input type="radio" name="sex" value="1"> 女
                <input type="radio" name="sex" value="2"> 男
            </div>
            <div>
                出生日期：<input type="text" name="birthday"><span style="color: red">${birthdayError}</span>
            </div>

            <div>
                电话：<input type="text" name="phone">
            </div>

            <div>
                地址：<input type="text" name="address">
            </div>

            <div>
                角色：
                <select name="roleId">
                    <option value="1">管理系统员</option>
                    <option value="2">店长</option>
                    <option value="3">店员</option>
                </select>
            </div>

            <div>
                证件照1：
                <input type="file" name="idPic"><span style="color: red">${idPicError}</span>
            </div>
            <div>
                证件照2：
                <input type="file" name="idPic2"><span style="color: red">${idPicError}</span>
            </div>

            <div>
                <input type="submit">
            </div>

        </form>
    </div>

    <script src="${pageContext.request.contextPath}/statics/layui/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['jquery'], function(){
            var $ = layui.$;

            $('#account').blur(function () {
                $.get('accountExists?account='+this.value,function (data) {
                    if(data=='1'){
                        //存在
                        $('#account').next().html('该账号已存在')
                    } else{
                        // 不存在
                        $('#account').next().html('')
                    }
                });
            });

        })
    </script>
</body>
</html>
